<?
$Db = new oracleDb;
$Db->init($_SESSION["ORCL"],
           $_SESSION["OPASS"],
           $_SESSION["SID"],
           _NO_COMMENT);

if($Db->connect()){

  $CLFetchers->fetchLstCbTx($Db,
                            $SourceDb->fetchValue("srcDbCbTx"),
                            $nCbTx,
                            $lstCbTx);

  $CFetchers->fetchLstCurrency($Db,
                               $SourceDb->fetchValue("srcDbMstCurrency"),
                               $nCurrency,
                               $lstCurrency);

  $Db->dc();
}else{

  $Misc->usrDieJs(_DB_CONN_ERROR);
}

$lstCbCode  = $Misc->retArray($_POST["cbCode"]);

$lstSuppCst = $Misc->retArray($_POST["suppCstNameEnt"]);

$lstType    = array("", "IN","OUT");

$propSuppCst  = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                 Ajax.suppCst(\"suppCstNameEnt\",
                                              \"typeEnt\");").

                $GJs->jsOnBlur ("Ajax.suppCstCode(\"suppCstCodeEnt\",
                                                  \"suppCstNameEnt\",
                                                  \"typeEnt\");
                                GMisc.setWhite2(this);");

$propCurrency = $GJs->jsOnFocus ("GMisc.setYellow2(this);").

                $GJs->jsOnChange("Ajax.getRate(this.value,
                                               \"trDateEnt\",
                                               \"rateEnt\");" ).

                $GJs->jsOnBlur  ("GMisc.setWhite2(this);");

$propType     = $GJs->jsOnFocus("GMisc.setYellow2(this);").

                $GJs->jsOnBlur ("GMisc.setWhite2(this);
                                 Misc.setSuppCst(\"typeEnt\",
                                                 \"supplierCustomer\");");

$propTx       = $GJs->jsOnFocus("GMisc.setYellow2(this);").

                $GJs->jsOnBlur ("GMisc.setWhite2(this);
                                 Ajax.setButton(\"txEnt\",
                                                \"txButton\");");

$prop["cbCode"] = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                   Ajax.setCbCode(this);").

                  $GJs->jsOnBlur ("GMisc.setWhite2(this);");

$prop["cbName"] = $GJs->jsOnFocus("GMisc.setYellow2(this);
                                   Ajax.setCbName(this,
                                                  \"cbCode\");").

                  $GJs->jsOnBlur ("GMisc.setWhite2(this);");


$_POST["memoEnt"]   = ($_POST["memoEnt"]   != "")? $_POST["memoEnt"] :
                                                   "default";

/**
 * ############################################
 * important key it connects the current entry
 * with the temporary table
 * ############################################
 */

$_SESSION["tmpJid"] = ($_SESSION["tmpJid"] != "")? $_SESSION["tmpJid"] :
                                                   $GProcessors->getTmpJid();

if($_POST["txEnt"] != ""){

  echo  $GJs->jsScript(_TYPE_JS, "Ajax.setButton(\"txEnt\",
                                                 \"txButton\");");
}else{

  /*Do nothing*/
}

echo 	$GJs->includeThis(_TYPE_CSS,"/ecs/myMenu.css").
      $GJs->includeThis(_TYPE_JS ,"/ecs/javascript/GMisc.js").
      $GJs->includeThis(_TYPE_JS ,"/ecs/javascript/GAjax.js").
      $GJs->includeThis(_TYPE_JS ,"javascript/misc.js").
      $GJs->includeThis(_TYPE_JS ,"javascript/ajax.js").
      $GJs->stopRKey().

      "<SCRIPT LANGUAGE=\"JavaScript\" SRC=\"../javascript/CalendarPopup.js\"></SCRIPT> \n".
			"<SCRIPT LANGUAGE=\"JavaScript\">\n".
			"var cal      = new CalendarPopup();\n".
			"</SCRIPT> \n".

 			/**
 			* Since this is to prevent default 'enter'
 			*
 			*/
 			"<body >\n".
 			"<form  name='initMe' action=entry.php method=post>\n".

 			/**
 			* Global header
 			*
 			*/
			"<table border='1' class='dedeq' >\n".
			"<tr>\n".

		  "<td class='solid'> DATE
		    <input type='submit'
		           onClick=\"cal.select(document.forms['initMe'].trDateEnt,
		                                'anchor1',
		                                'dd-MM-yyyy');
		                     return false;\"
		           NAME=\"anchor1\"
		           ID=\"anchor1\"
		           value='Select'></td>

		      <td >	".$GHtml->formInput("trDateEnt",
                                    $_POST["trDateEnt"],
                                    $Misc->stdProperties())." </td> \n".

      "</tr>\n".
      "<tr>\n".

      "<td class='solid'> Cash-Bank </td>
        <td> <table border='1' class='dedeq'>
             <tr>

             <td> ".$GHtml->formDropDown("cbCode",
                                         $_POST["cbCode"],
                                         $lstCbCode,
                                         $prop["cbCode"])." </td>

             <td> ".$GHtml->formInput("cbName",
                                      $_POST["cbName"],
                                      $prop["cbName"])." </td>
             </tr>
             </table> </td>\n".

      "</tr>\n".
      "<tr>\n".

      "<td class='solid'> Type     </td>
        <td> ".$GHtml->formDropDown("typeEnt",
                                    $_POST["typeEnt"],
                                    $lstType,
                                    $propType)." </td>\n".

      "</tr>\n".
      "<tr>\n".

      "<td class='solid'> Currency </td>
        <td> ".$GHtml->formDropDown("currencyEnt",
                                    $_POST["currencyEnt"],
                                    $lstCurrency,
                                    $propCurrency)." </td>\n".

      "</tr>\n".
      "<tr>\n".

      "<td class='solid'> Rate     </td>
        <td> ".$GHtml->formInput("rateEnt",
                                 $_POST["rateEnt"],
                                 $Misc->stdProperties())." </td>\n".

      "</tr>\n".
      "<tr>\n".

      "<td name='supplierCustomer'  class='solid'>  </td>
        <td> <table border='1' class='dedeq'>
             <tr>

             <td> ".$GHtml->formDropDown("suppCstNameEnt",
                                         $_POST["suppCstNameEnt"],
                                         $lstSuppCst,
                                         $propSuppCst)." </td>

             <td> ".$GHtml->formInput("suppCstCodeEnt",
                                      $_POST["suppCstCodeEnt"],
                                      $Misc->stdProperties())." </td>
             </tr>
             </table> </td>\n".

      "</tr>\n".
      "<tr>\n".

      "<td class='solid'> Transaction </td>
        <td> ".$GHtml->formDropDown("txEnt",
                                    $_POST["txEnt"],
                                    $lstCbTx,
                                    $propTx)." </td>\n".

      "</tr>\n".
      "<tr>\n".

      "<td class='solid'> Memo        </td>
        <td> ".$GHtml->formTextArea("memoEnt",
                                     $_POST["memoEnt"],
                                     $Misc->stdStyle100().
                                     $Misc->stdProperties())."   </td>\n".

      "</tr>\n".
			"</table><br/>\n";

?>